package com.cskaoyan.shopping.controller.zeng;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.shopping.dto.PanelContentDto;
import com.cskaoyan.shopping.dto.PanelDto;
import com.cskaoyan.shopping.dto.ProductCateDto;
import com.cskaoyan.shopping.service.IHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * @author: zeng
 * @Description: 商品前三个接口
 * @date: 15:05 2022/12/3
 */
@RestController
public class ShoppingController2 {
    /**
     * @author: zeng
     * @Description:homepage
     * @date: 17:24 2022/12/3
     */


    @Autowired
    IHomeService homeService;


    @GetMapping("/shopping/homepage")
    public ResponseData showHomePage() {
        Set<PanelDto> homepage = homeService.homepage();
        ResponseData<Object> responseData = new ResponseUtil<>().setData(homepage);
        return responseData;
    }
    @GetMapping("/shopping/navigation")
    public ResponseData showNavigation() {
        List<PanelContentDto> navigate = homeService.navigate();
        ResponseData<Object> responseData = new ResponseUtil<>().setData(navigate);
        return responseData;
    }
    @GetMapping("/shopping/categories")
    public ResponseData showAllGoodsCategory() {
        List<ProductCateDto> productCateDtos = homeService.categories();
        ResponseData<Object> responseData = new ResponseUtil<>().setData(productCateDtos);
        return responseData;
    }
}
